<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      /*
        所有的继承，默认都是原型继承
        1. 构造函数继承
        2. 类继承
        3. 直接修改原型
      */
      class Person {
        username = "lili";
        static username = "jack";
      }
      class User extends Person {}

      /*
      Object.prototype = {
        __proto__: null,
      };
      Person.prototype = {
        __proto__: Object.prototype,
      };
      u = {
        __proto__: Person.prototype,
      };
      */
      const u = new User();
      console.log(u.username); //lili

      /*
      Object.prototype = {
        __proto__: null,
      };
      Function.prototype = {
        __proto__: Object.prototype,
      };
      Person = {
        __proto__: Function.prototype,
      };
      User = {
        __proto__: Person,
      };
      */
      console.log(User.username);
      console.log(User.__proto__);
      console.log(Person.__proto__ === Function.prototype);
    </script>
  </body>
</html>
